Fix spurious warning when using empty conflictColumns with MySQL#1028
Merged
dereuromark merged 1 commit into5.xfrom Feb 24, 2026
Merged
Fix spurious warning when using empty conflictColumns with MySQL#1028dereuromark merged 1 commit into5.xfrom
dereuromark merged 1 commit into5.xfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a spurious MySQL warning when insertOrUpdate() is called with an empty conflictColumns array (the natural MySQL “no-op” value), and adds a regression test to ensure the behavior stays correct.
Changes:
- Update MySQL upsert warning logic to only warn when
conflictColumnsis non-empty. - Add a MySQL adapter test that verifies
insertOrUpdate(..., conflictColumns: [])does not emitE_USER_WARNING.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Db/Adapter/AbstractAdapter.php |
Refines the MySQL conflictColumns warning condition to treat [] as “not provided”. |
tests/TestCase/Db/Adapter/MysqlAdapterTest.php |
Adds regression coverage to ensure empty conflictColumns does not trigger warnings on MySQL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AbstractAdapter::getUpsertClause()checked$conflictColumns !== nullto decide whether to warn MySQL users about ignored conflict columns, butBaseSeed::insertOrUpdate()requires callers to pass anarray(no null default). The natural MySQL value is[], which passed the!== nullcheck and triggered a spuriousE_USER_WARNING.&& $conflictColumns !== []to the condition, matching the pattern already used bySqliteAdapter::getUpsertClause().Test plan
testInsertOrUpdateWithEmptyConflictColumnsDoesNotWarntoMysqlAdapterTestinsertOrUpdatetests still pass for MySQL and SQLite